/**
 * 
 */
package com.hfjyz.examination.manager.impl;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.validation.BindException;
import org.springframework.validation.Errors;

import com.hfjyz.examination.command.CategoryEditCommand;
import com.hfjyz.examination.dao.QuestionCategoryDao;
import com.hfjyz.examination.domain.QuestionCategory;
import com.hfjyz.examination.manager.QuestionCategoryManager;

/**
 * 
 */
public class QuestionCategoryManagerImpl implements QuestionCategoryManager {

	private QuestionCategoryDao questionCategoryDao;

	@Override
	public void editOk(HttpServletRequest request,
			CategoryEditCommand command, BindException errors)
			throws Exception {

	}

	@SuppressWarnings("rawtypes")
	@Override
	public Map initEdit(HttpServletRequest request,
			CategoryEditCommand command, Errors errors)
			throws Exception {
		if (command.getId() != null) {
			QuestionCategory category = questionCategoryDao
					.get(command.getId());
			command.setCategory(category);
		}
		return null;
	}

	/**
	 * @return the questionCategoryDao
	 */
	public QuestionCategoryDao getQuestionCategoryDao() {
		return questionCategoryDao;
	}

	/**
	 * @param questionCategoryDao
	 *            the questionCategoryDao to set
	 */
	public void setQuestionCategoryDao(QuestionCategoryDao dao) {
		this.questionCategoryDao = dao;
	}

}
